package com.springboot.controller;

import com.springboot.Service.BookBTypeService;
import com.springboot.entity.Booktype;
import com.springboot.utils.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(value = "提供了查询、增加等相关的接口",tags = "图书分类管理")
@CrossOrigin
@RestController
public class BookTypController {
    @Resource
    private BookBTypeService bookBTypeService;
    @RequestMapping(value = "/booktypeList",method = RequestMethod.GET)
    @ApiOperation("书籍分类查询分页接口")
    public ResultVO showList(String name, @RequestParam(defaultValue = "1") int pageNum) {
        return bookBTypeService.BookTypeList(name, pageNum);
    }
    @RequestMapping(value = "/addBookType",method = RequestMethod.POST)
    @ApiOperation("书籍分类新增接口")
    public ResultVO addBookType(Booktype booktype){
        return bookBTypeService.addBookType(booktype);
    }
    @RequestMapping(value = "/deleteBookType",method = RequestMethod.GET)
    @ApiOperation("书籍分类删除接口")
    public ResultVO deleteBookType(@RequestParam("tid") long tid){
        return bookBTypeService.deleteBookType(tid);
    }

    @RequestMapping(value = "/saveBookType",method = RequestMethod.GET)
    @ApiOperation("书籍修改接口")
    public ResultVO saveBookType(Booktype booktype){
        return bookBTypeService.saveBookType(booktype);
    }
}
